package com.heima.wemedia;

import com.heima.common.aliyun.ScanImage;
import com.heima.common.aliyun.ScanText;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author 张一恒
 * @version 1.0
 * @description:
 * @date 2023/1/13 13:28
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class Aliyun {

    @Value("${aliyun.accessKeyId}")
    String accessKeyId;

    @Value("${aliyun.secret}")
    String secret;

    @Autowired
    private ScanText greenTextScan;


    @Test
    public void test() {
        ScanImage scan = new ScanImage();
        List<String> url = new ArrayList<>();
        url.add("http://a6u9em.natappfree.cc/leadnews/2023/01/11/4efa2c474c46498c92bdc6cce81e8949.png");
        url.add("http://a6u9em.natappfree.cc/leadnews/2023/01/11/4efa2c474c46498c92bdc6cce81e8949.png");
        Map map = scan.imageScan(url);
        System.out.println(map.get("suggestion"));
    }

    @Test
    public void testScanText() throws Exception {
        ScanText scanText = new ScanText();
        scanText.setAccessKeyId(accessKeyId);
        scanText.setSecret(secret);
        Map map = scanText.greeTextScan("我吸冰毒");
        System.out.println(map);
    }
}
